import {useEffect, useState} from 'react'

const useUpdate = (fn,arr)=>{
  const [count,setCount] = useState(0)
  useEffect(()=>{
    setCount((count)=>count+1)
  },[arr])
  useEffect(()=>{
    if (count>1){
      fn()
    }
  },[arr])// eslint-disable-line react-hooks/exhaustive-deps
}
export default useUpdate